<template>
  <div id="loginDiv">
<!--    <img src="../src/assets/XTlogo.png" alt="">-->
    <el-image src="https://image.hsintiao.com/8313598471983713.jpg" style="width: 40%"></el-image>
    <div id="loginRight">
      <p> 后台管理系统 </p>
      <el-form :model="loginData" label-width="120px">
        <el-form-item label="登录账户">
          <el-input v-model="loginData.user" placeholder="请输入电话号码"></el-input>
        </el-form-item>
        <el-form-item label="密码">
          <el-input v-model="loginData.password" placeholder="请输入验证码" type="password"></el-input>
        </el-form-item>
      </el-form>
      <el-button type="primary" plain @click="click_login">发送</el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
import { reactive } from "@vue/reactivity";
import { login } from "../api/api";
import router from "../router/router";
import { setToken } from "../token/token";
let loginData = reactive({
  user: "",
  password: "",
});

function click_login() {
  login(loginData).then((res: any) => {
    console.log(res);
    if (res.code === 200) {
      console.log(111);
      setToken(res.data);
      router.push("index");
    }
  });
}
</script>

<style scoped>
#loginDiv {
  width: 100%;
  height: 100%;
  min-width: 600px;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

#login {
  height: 100%;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
</style>
